package com.example.sevicedemo

import android.app.Service
import android.content.Intent
import android.content.res.Configuration
import android.os.Binder
import android.os.IBinder

class MyService02 : Service() {

    private val mBinder = DownloadBinder()

    class DownloadBinder : Binder() {
        fun startDownload() {
            println("DownloadBinder.startDownload")
        }

        fun getProgress(): Int {
            println("DownloadBinder.getProgress")
            return 0;
        }

        interface LoginLinter {
            fun loginLinter(loginStatus: Int, loginUser: String?);
        }

        var mLoginLinter: LoginLinter? = null

        public fun setLoginLinter(mLoginLinter: LoginLinter?) {
            this.mLoginLinter = mLoginLinter;
        }

    }

    override fun onBind(intent: Intent): IBinder {
        println("MyService02.onBind")
        return mBinder;
    }

    override fun onCreate() {
        super.onCreate()
        println("MyService02.onCreate")
    }





    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        println("MyService02.onStartCommand")
        //采用bind服务的方式，这里就不在回调啦
        return super.onStartCommand(intent, flags, startId)
    }
}